<template>
	<view class="addZfb">
		<!--  bgcolor="#FD9031" -->
		<title :center="true" title="添加账户" iconSize="38" bgcolor="linear-gradient(45deg, #f43f3b, #ec008c)" color="#FFF"
			@to-click="toBack(1)" icon="/static/img/other/to-back.png"></title>
		<view class="addZfb_body">
			<view class="zfbName f border">
				<view class="title">
					<u-icon name="zhifubao" class="bl mr5"></u-icon>
					<text>收款人姓名</text>
				</view>
				<input class="inp" type="text" v-model="ZFB.name" placeholder="请输入收款人姓名" />
			</view>
			<view class="zfbAccount f border">
				<view class="title">
					<u-icon name="zhifubao" class="bl mr5"></u-icon>
					<text>收款人账号</text>
				</view>
				<input class="inp" type="text" v-model="ZFB.account" placeholder="请输入收款人账户" />
			</view>
			<view class="confirmAccount f">
				<view class="title">
					<u-icon name="zhifubao" class="bl mr5"></u-icon>
					<text>确认账号</text>
				</view>
				<input class="inp" type="text" v-model="ZFB.conAccount" placeholder="确认收款人账户" />
			</view>
			<button type="default" class="btn" @click="add">确认添加</button>
		</view>
	</view>
</template>

<script>
	import title from '@/pages/components/title.vue'
	export default {
		data() {
			return {
				ZFB: {
					name: '',
					account: "",
					conAccount: ""
				}
			}
		},
		components: {
			title
		},
		methods: {
			// 跳转
			toBack(i) {
				uni.navigateBack({
					delta: i
				})
			},
			// 添加
			add() {
				if (this.ZFB.name === "" || this.ZFB.account === "" || this.ZFB.conAccount === "") {
					uni.showToast({
						title: '输入的内容不能为空',
						icon: 'none'
					})
				} else if (this.ZFB.account != this.ZFB.conAccount) {
					uni.showToast({
						title: '两次输入的账号不一致',
						icon: 'none'
					})
				} else {
					// 接入提交支付宝账户
					let data = {
						ali_name: this.ZFB.name,
						ali_account: this.ZFB.account,
						ali_account_submit: this.ZFB.conAccount
					}
					this.$api.setAliPayAccount(data).then((res) => {
						console.log(res.data.msg)
						if (res.data.msg == "操作成功") {
							console.log(123456)
							uni.navigateBack({
								delta: 1
							})
						}
					})
				}
			}

		}
	}
</script>

<style lang="scss" scoped>
	.bl {
		color: #0081ff;
	}

	.addZfb {
		background-color: #F1F1F1;
		width: 100vw;
		height: 100vh;
		padding-top: 155rpx;

		.addZfb_body {
			width: 750rpx;
			height: 360rpx;
			background: #FFFFFF;
			padding: 38rpx 24rpx;

			.border {
				padding-bottom: 38rpx;
				border-bottom: 1rpx solid #F1F1F1;
				margin-bottom: 38rpx;
			}

			.title {
				width: 40%;
				font-size: 30rpx;
				font-weight: bold;
				color: #333333;
			}

			.inp {
				width: 45%;
				font-size: 24rpx;
				font-weight: 400;
				color: #999999;
			}

			.btn {
				margin-top: 136rpx;
				width: 701rpx;
				height: 88rpx;
				background: linear-gradient(91deg, #EF4447 0%, #EF298A 100%);
				border-radius: 44px;
				font-weight: 500;
				font-size: 32rpx;
				color: #FEFEFE;
				margin-bottom: 20rpx;
			}

		}
	}

	.f {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
</style>
